<template>
  <section>
    <el-option
      :key="option.value"
      :label="option.label"
      :value="option.value"
      v-html="display"
    >
    </el-option>
    <select-recursion
      v-for="item in option.children"
      :key="item.value"
      :option="item"
      :level="level + 1"
    ></select-recursion>
  </section>
</template>

<script>
export default {
  name: "select-recursion",
  props: {
    option: {
      default: {}
    },
    level: {
      default: 0
    }
  },
  computed: {
    display() {
      let tab = "&nbsp;&nbsp;";
      let str = "";
      for (let i = 0; i < this.level; i++) {
        str += tab;
      }
      str += this.option.label;
      return str;
    }
  }
};
</script>

<style scoped></style>
